function combine(arr1, arr2) {
	let i = 0;
	let n = 0;
	const result = [];
	while (1) {
		if (arr1[i] < arr2[n]) {
			result.push(arr1[i]);
			i++;
		} else {
			result.push(arr2[n]);
			n++;
		}
		if (result.length == arr1.length + arr2.length) break;
	}
	return result;
}

console.log(combine([1, 3, 5], [2, 4, 6]));
